function ajax(config){
    return new Promise(function(resolve){
        let xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function(){
            if(xhr.readyState == 4 && xhr.status == 200){
                let text = JSON.parse(xhr.responseText);
                // config.success(text);
                resolve(text);
            }
        }
        xhr.open(config.type,config.url,config.async);
        xhr.send(config.data);
    });
    
}